import 'package:flutter/material.dart';
import 'dart:async';

import 'package:logcat_viewer/logcat_viewer.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  List<String> _logList = [];

  @override
  void initState() {
    super.initState();
    Timer.periodic(const Duration(seconds: 1), (timer) {
      print("now print tick = ${timer.tick}");
      if (timer.tick % 5 == 0) {
        print("this is an error now print tick = ${timer.tick}");
      }
      if (timer.tick % 10 == 0) {
        print("this is link http://www.baidu.com now print tick = ${timer.tick}");
      }
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: const OverlayContainer(
          debug: true,
          child: Center(
            child: Text("点击悬浮窗口查看log"),
          ),
        ),
        // SingleChildScrollView(
        //   child: Column(
        //     children: [
        //       Row(
        //         mainAxisAlignment: MainAxisAlignment.spaceBetween,
        //         children: [
        //           TextButton(
        //             onPressed: (){
        //               startLogInfo();
        //             },
        //             child: Text("开始"),
        //           ),
        //           TextButton(
        //             onPressed: (){
        //               stopLogInfo();
        //             },
        //             child: Text("结束"),
        //           ),
        //         ],
        //       ),
        //       Expanded(
        //         child: ListView(
        //           children: _logList.map((e) => Text(e)).toList(),
        //         ),
        //       ),
        //     ],
        //   ),
        // ),
      ),
    );
  }
}
